package LECONGHAU.STRUCTURE_PROGRAMMING.EXCERCISES;

import java.util.Scanner;

public class vd02 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
String a,b;
String c;

do{
	System.out.println("nhap vao gia tri cua a");
	Scanner sc=new Scanner(System.in);
	a=sc.nextLine();
	
if(a.isEmpty()){
	System.out.println("chua nhap a! nhap lai nha");
}
}while(a.isEmpty());
double soa=Double.parseDouble(a);
do{
	System.out.println("nhap vao gia tri cua b");
	Scanner sc=new Scanner(System.in);
	b=sc.nextLine();
	if(b.isEmpty()){
		System.out.println("chua nhap b! nhap lai nha");
	}
}while(b.isEmpty());


Scanner sc=new Scanner(System.in);
double sob=Double.parseDouble(b);
System.out.println("chon phep tinh + hoac - hoac * hoac /");
sc=new Scanner(System.in);
c=sc.nextLine();
switch (c) {
case "+":System.out.println("ket qua phep cong la "+(soa+sob));
	break;
case "-":System.out.println("ket qua phep tru la "+(soa-sob));
break;
case "*":System.out.println("ket qua phep nhan la "+(soa*sob));
break;
case "/":
	if(sob==0){
		System.out.println("khong chia duoc cho 0");
	}else {
		System.out.println("ket qua phep chia la "+(soa/sob));
	}
	
break;
default:System.out.println("nhap cai gi vay");
	break;
}
	}

}
